#include <iostream>
using namespace std;

int main()
{
    const int N = 21;
    int a[N];
    int *p;
    int n;

    //输入
    p = a;
    n = 0;
    cin >> *p;
    while (*p != 9999)
    {
        n++;
        if (n == N)
        {
            break;
        }
        p++;
        cin >> *p;
    }

    if (n > 0)
    {
        p = a;
        cout << *p;
        p++;
        while (p < a + n)
        {
            cout << " " << *p;
            p++;
        }
        cout << endl;
    }
    return 0;
}
